const staff_login = {
    template:`
    <div class="container">
        <div class="row d-flex justify-content-center">
            <div class="col-3 card mt-5 shadow">
                <h3 class="text-primary text-center my-4">Staff Login</h3>
                <div>
                    <div class="form-group">
                        <label>Email:</label>
                        <input type="text" class="form-control" placeholder="Email" v-model="form.email">
                    </div>
                    <div class="form-group">
                        <label>Password:</label>
                        <input type="password" class="form-control" placeholder="Password" v-model="form.password">
                    </div>
                    <div class="form-group">
                        <button class="btn btn-primary w-100" @click="login">Login</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    `,
    data() {
        return {
            form:{
                email:null,
                password:null
            }
        };
    },
    methods:{
        login(){
            ajax.post('login',this.form).then(res =>{
                if (res.status === 200){
                    store.set_auth(res.data.data);
                    this.$router.push({name:'staff.index'})
                }
            })
        }
    }
};